Coder Social home page Coder Social logo

netflix-catalog-api's Introduction

Netflix Catalog API

Category Entity

This Python module implements a Category class representing a category with a name, description, and an activation status.

Business Rule

  • A category must have a name.
  • The name of the category must have less than 256 characters.
  • When a category is created, it must be assigned a UUID as its identifier.
  • A category is created with default values if no additional values are provided.
  • The default value for the is_active attribute is True.
  • The string representation of a category follows the format: <name> - <description> (<is_active>). The representation of a category (__repr__ method) follows the format: <Category <name> <id>>.

Test Cases

The following test cases are implemented to ensure the correctness of the Category class:

  • Test Name is Required

    • Description: Ensure that an error is raised when trying to create a category without providing a name.
    • Expected Result: TypeError with message "missing 1 required positional argument: 'name'".
  • Test Name Length Limit

    • Description: Ensure that an error is raised when the name provided for a category exceeds 255 characters.
    • Expected Result: ValueError with message "name must have less than 256 characters".
  • Test Category Creation with UUID

    • Description: Ensure that a category is created with a UUID as its identifier.
    • Expected Result: The id attribute of the created category is of type UUID.
  • Test Default Category Creation

    • Description: Ensure that a category is created with default values when no additional values are provided.
    • Expected Result: The category has an empty description and is active.
  • Test Category Creation with Provided Values

    • Description: Ensure that a category is created with the provided values.
    • Expected Result: The category has the provided attributes.
  • Test String Representation

    • Description: Ensure that the string representation of a category is correct.
    • Expected Result: The string representation matches the expected format.
  • Test Representation Method (repr)

    • Description: Ensure that the representation method returns the correct string.
    • Expected Result: The representation string matches the expected format.

netflix-catalog-api's People

Contributors

hvdgeek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.