Beispiel #1
0
    def test_create_game_subtitle_relation(self):
        subtitle = helper.generate_subtitle("Subtitle 1", "00:00:02.100",
                                            "00:00:06.769")
        game = helper.generate_game("Game 1", "Developer 1")

        self.client.create(helper.extract_attribute(game), "Game",
                           game["uuid"])
        self.client.create(helper.extract_attribute(subtitle), "Subtitle",
                           subtitle["uuid"])

        time.sleep(2)

        self.client.add_reference(subtitle["uuid"], "ofGame", game["uuid"])

        time.sleep(2)

        output_video = self.client.get(subtitle["uuid"])

        video_schema = output_video.get("schema")

        self.assertEqual(len(video_schema.get("ofGame")), 1)
        self.assertIn(game["uuid"], video_schema.get("ofGame")[0]["href"])

        delete_platform = self.client.delete(subtitle["uuid"])
        delete_game = self.client.delete(game["uuid"])
        self.assertIsNone(delete_platform)
        self.assertIsNone(delete_game)
Beispiel #2
0
    def test_create_game_video_relation(self):
        video = helper.generate_video("Video 1", "123", "Description", 60, 100)
        game = helper.generate_game("Game 1", "Developer 1")

        self.client.create(helper.extract_attribute(game), "Game",
                           game["uuid"])
        self.client.create(helper.extract_attribute(video), "Video",
                           video["uuid"])

        time.sleep(2)

        self.client.add_reference(video["uuid"], "ofGame", game["uuid"])

        time.sleep(2)

        output_video = self.client.get(video["uuid"])

        video_schema = output_video.get("schema")

        self.assertEqual(len(video_schema.get("ofGame")), 1)
        self.assertIn(game["uuid"], video_schema.get("ofGame")[0]["href"])

        delete_platform = self.client.delete(video["uuid"])
        delete_game = self.client.delete(game["uuid"])
        self.assertIsNone(delete_platform)
        self.assertIsNone(delete_game)
Beispiel #3
0
    def test_create_game_genre_relation(self):
        genre = helper.generate_genre("Genre 1")
        game = helper.generate_game("Game 1", "Developer 1")

        self.client.create(helper.extract_attribute(game), "Game",
                           game["uuid"])
        self.client.create(helper.extract_attribute(genre), "Genre",
                           genre["uuid"])

        time.sleep(2)

        self.client.add_reference(genre["uuid"], "hasGames", game["uuid"])
        self.client.add_reference(game["uuid"], "ofGenre", genre["uuid"])

        time.sleep(2)

        output_genre = self.client.get(genre["uuid"])
        output_game = self.client.get(game["uuid"])

        genre_schema = output_genre.get("schema")
        game_schema = output_game.get("schema")

        self.assertEqual(len(genre_schema.get("hasGames")), 1)
        self.assertEqual(len(game_schema.get("ofGenre")), 1)
        self.assertIn(genre["uuid"], game_schema.get("ofGenre")[0]["href"])
        self.assertIn(game["uuid"], genre_schema.get("hasGames")[0]["href"])

        delete_platform = self.client.delete(genre["uuid"])
        delete_game = self.client.delete(game["uuid"])
        self.assertIsNone(delete_platform)
        self.assertIsNone(delete_game)
Beispiel #4
0
    def test_create_game_tag_relation(self):
        tag = helper.generate_tag("Tag 1")
        game = helper.generate_game("Game 1", "Developer 1")

        self.client.create(helper.extract_attribute(game), "Game",
                           game["uuid"])
        self.client.create(helper.extract_attribute(tag), "Tag", tag["uuid"])

        time.sleep(2)

        self.client.add_reference(tag["uuid"], "hasGames", game["uuid"])

        time.sleep(2)

        output_tag = self.client.get(tag["uuid"])

        tag_schema = output_tag.get("schema")

        self.assertEqual(len(tag_schema.get("hasGames")), 1)
        self.assertIn(game["uuid"], tag_schema.get("hasGames")[0]["href"])

        delete_platform = self.client.delete(tag["uuid"])
        delete_game = self.client.delete(game["uuid"])
        self.assertIsNone(delete_platform)
        self.assertIsNone(delete_game)
Beispiel #5
0
    def test_create_simple_game(self):
        game1 = helper.generate_game("Game 1", "Developer 1", [], [])
        self.client.create(helper.extract_attribute(game1), "Game",
                           game1["uuid"])

        time.sleep(2)

        output_game1 = self.client.get(game1["uuid"])
        self.assertEqual(output_game1.get("class"), "Game")
        self.assertEqual(output_game1.get("id"), game1["uuid"])
        self.assertEqual(output_game1.get("schema").get("name"), game1["name"])
        self.assertEqual(
            output_game1.get("schema").get("developer"), game1["developer"])
        self.assertEqual(
            output_game1.get("schema").get("ofGenre"), game1["ofGenre"])
        self.assertEqual(
            output_game1.get("schema").get("onPlatform"), game1["onPlatform"])

        delete_output = self.client.delete(game1["uuid"])
        self.assertIsNone(delete_output)