Beispiel #1
0
    def test_populate_database_non_existent_model(self):
        # given
        item = Mock()
        item.type = 'random'
        item.properties = ['']
        items = [item]

        # then
        with self.assertRaises(NonExistentModelException):
            populate_database(items)
    def test_populate_database_non_existent_model(self):
        # given
        item = Mock()
        item.type = 'random'
        item.properties = ['']
        items = [item]

        # then
        with self.assertRaises(NonExistentModelException):
            populate_database(items)
Beispiel #3
0
    def test_populate_database_add_project(self):
        # given
        item = Mock()
        item.type = 'project'
        item.properties = ['title', 'filename', 'techno', 'url', 1]
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_project_with_title_exists_in_database(item.properties[0])
Beispiel #4
0
    def test_populate_database_add_technology(self):
        # given
        item = Mock()
        item.type = 'technology'
        item.properties = ['techno_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_technology_with_name_exists_in_database(item.properties[0])
Beispiel #5
0
    def test_populate_database_add_status(self):
        # given
        item = Mock()
        item.type = 'status'
        item.properties = ['status_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_status_with_name_exists_in_database(item.properties[0])
Beispiel #6
0
    def test_populate_database_add_user(self):
        # given
        item = Mock()
        item.type = 'user'
        item.properties = ['bob', '*****@*****.**', 'bobpw']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_user_with_username_exists_in_database(item.properties[0])
    def test_populate_database_add_project(self):
        # given
        item = Mock()
        item.type = 'project'
        item.properties = ['title', 'filename', 'techno', 'url', 1]
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_project_with_title_exists_in_database(item.properties[0])
    def test_populate_database_add_technology(self):
        # given
        item = Mock()
        item.type = 'technology'
        item.properties = ['techno_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_technology_with_name_exists_in_database(item.properties[0])
    def test_populate_database_add_status(self):
        # given
        item = Mock()
        item.type = 'status'
        item.properties = ['status_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_status_with_name_exists_in_database(item.properties[0])
    def test_populate_database_add_user(self):
        # given
        item = Mock()
        item.type = 'user'
        item.properties = ['bob', '*****@*****.**', 'bobpw']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_user_with_username_exists_in_database(item.properties[0])
    def test_populate_database_add_post(self):
        # given
        item = Mock()
        item.type = 'post'
        item.properties = ['title', 'filename', datetime.now(), 'category', 'author']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_post_with_title_exists_in_database(item.properties[0])
Beispiel #12
0
    def test_populate_database_add_post(self):
        # given
        item = Mock()
        item.type = 'post'
        item.properties = [
            'title', 'filename',
            datetime.now(), 'category', 'author'
        ]
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_post_with_title_exists_in_database(item.properties[0])