Пример #1
0
    def test_software_recipes_table(self):
        """Test structure returned for Software RecipesTable"""
        table = SoftwareRecipesTable()
        request = RequestFactory().get('/foo/', {'format': 'json'})
        response = table.get(request, pid=self.project.id)
        data = json.loads(response.content)

        rows = data['rows']
        row1 = next(x for x in rows if x['name'] == self.recipe1.name)
        row2 = next(x for x in rows if x['name'] == self.recipe2.name)

        self.assertEqual(response.status_code, 200, 'should be 200 OK status')
        self.assertEqual(len(rows), 2, 'should be 2 recipes')

        # check other columns have been populated correctly
        self.assertEqual(row1['name'], self.recipe1.name)
        self.assertEqual(row1['version'], self.recipe1.version)
        self.assertEqual(row1['get_description_or_summary'],
                         self.recipe1.description)
        self.assertEqual(row1['layer_version__layer__name'],
                         self.recipe1.layer_version.layer.name)
        self.assertEqual(row2['name'], self.recipe2.name)
        self.assertEqual(row2['version'], self.recipe2.version)
        self.assertEqual(row2['get_description_or_summary'],
                         self.recipe2.description)
        self.assertEqual(row2['layer_version__layer__name'],
                         self.recipe2.layer_version.layer.name)
Пример #2
0
    def test_software_recipes_table(self):
        """Test structure returned for Software RecipesTable"""
        table = SoftwareRecipesTable()
        request = RequestFactory().get('/foo/', {'format': 'json'})
        response = table.get(request, pid=self.project.id)
        data = json.loads(response.content)

        rows = data['rows']
        row1 = next(x for x in rows if x['name'] == self.recipe1.name)
        row2 = next(x for x in rows if x['name'] == self.recipe2.name)

        self.assertEqual(response.status_code, 200, 'should be 200 OK status')

        # check other columns have been populated correctly
        self.assertTrue(self.recipe1.name in row1['name'])
        self.assertTrue(self.recipe1.version in row1['version'])
        self.assertTrue(
            self.recipe1.description in row1['get_description_or_summary'])

        self.assertTrue(self.recipe1.layer_version.layer.name in
                        row1['layer_version__layer__name'])

        self.assertTrue(self.recipe2.name in row2['name'])
        self.assertTrue(self.recipe2.version in row2['version'])
        self.assertTrue(
            self.recipe2.description in row2['get_description_or_summary'])

        self.assertTrue(self.recipe2.layer_version.layer.name in
                        row2['layer_version__layer__name'])
Пример #3
0
    def test_software_recipes_table(self):
        """Test structure returned for Software RecipesTable"""
        table = SoftwareRecipesTable()
        request = RequestFactory().get("/foo/", {"format": "json"})
        response = table.get(request, pid=self.project.id)
        data = json.loads(response.content)

        rows = data["rows"]
        row1 = next(x for x in rows if x["name"] == self.recipe1.name)
        row2 = next(x for x in rows if x["name"] == self.recipe2.name)

        self.assertEqual(response.status_code, 200, "should be 200 OK status")

        # check other columns have been populated correctly
        self.assertEqual(row1["name"], self.recipe1.name)
        self.assertEqual(row1["version"], self.recipe1.version)
        self.assertEqual(row1["get_description_or_summary"], self.recipe1.description)
        self.assertEqual(row1["layer_version__layer__name"], self.recipe1.layer_version.layer.name)
        self.assertEqual(row2["name"], self.recipe2.name)
        self.assertEqual(row2["version"], self.recipe2.version)
        self.assertEqual(row2["get_description_or_summary"], self.recipe2.description)
        self.assertEqual(row2["layer_version__layer__name"], self.recipe2.layer_version.layer.name)
Пример #4
0
    def test_software_recipes_table(self):
        """Test structure returned for Software RecipesTable"""
        table = SoftwareRecipesTable()
        request = RequestFactory().get('/foo/', {'format': 'json'})
        response = table.get(request, pid=self.project.id)
        data = json.loads(response.content.decode('utf-8'))

        recipes = Recipe.objects.filter(Q(is_image=False))
        self.assertTrue(
            len(recipes) > 1, "Need more than one software recipe to test "
            "SoftwareRecipesTable")

        recipe1 = recipes[0]
        recipe2 = recipes[1]

        rows = data['rows']
        row1 = next(x for x in rows if x['name'] == recipe1.name)
        row2 = next(x for x in rows if x['name'] == recipe2.name)

        self.assertEqual(response.status_code, 200, 'should be 200 OK status')

        # check other columns have been populated correctly
        self.assertTrue(recipe1.name in row1['name'])
        self.assertTrue(recipe1.version in row1['version'])
        self.assertTrue(
            recipe1.description in row1['get_description_or_summary'])

        self.assertTrue(recipe1.layer_version.layer.name in
                        row1['layer_version__layer__name'])

        self.assertTrue(recipe2.name in row2['name'])
        self.assertTrue(recipe2.version in row2['version'])
        self.assertTrue(
            recipe2.description in row2['get_description_or_summary'])

        self.assertTrue(recipe2.layer_version.layer.name in
                        row2['layer_version__layer__name'])
Пример #5
0
    def test_software_recipes_table(self):
        """Test structure returned for Software RecipesTable"""
        table = SoftwareRecipesTable()
        request = RequestFactory().get('/foo/', {'format': 'json'})
        response = table.get(request, pid=self.project.id)
        data = json.loads(response.content.decode('utf-8'))

        recipes = Recipe.objects.filter(Q(is_image=False))
        self.assertTrue(len(recipes) > 1,
                        "Need more than one software recipe to test "
                        "SoftwareRecipesTable")

        recipe1 = recipes[0]
        recipe2 = recipes[1]

        rows = data['rows']
        row1 = next(x for x in rows if x['name'] == recipe1.name)
        row2 = next(x for x in rows if x['name'] == recipe2.name)

        self.assertEqual(response.status_code, 200, 'should be 200 OK status')

        # check other columns have been populated correctly
        self.assertTrue(recipe1.name in row1['name'])
        self.assertTrue(recipe1.version in row1['version'])
        self.assertTrue(recipe1.description in
                        row1['get_description_or_summary'])

        self.assertTrue(recipe1.layer_version.layer.name in
                        row1['layer_version__layer__name'])

        self.assertTrue(recipe2.name in row2['name'])
        self.assertTrue(recipe2.version in row2['version'])
        self.assertTrue(recipe2.description in
                        row2['get_description_or_summary'])

        self.assertTrue(recipe2.layer_version.layer.name in
                        row2['layer_version__layer__name'])