Esempio n. 1
0
    def test_financial_org_dictionary_1(self):
        """Test dictionary method of financial org class"""

        example1 = FinancialOrg("id", "name", "summary", "city", "companies", "twitter",
                                "website", "logo")
        dict_rep = example1.dictionary()

        self.assertEqual(dict_rep['financial_org_id'], "id")
        self.assertEqual(dict_rep['name'], "name")
        self.assertEqual(dict_rep['summary'], "summary")
        self.assertEqual(dict_rep['city'], "city")
Esempio n. 2
0
    def test_financial_org_repr_2(self):
        """Test __repr__ methond of financial org class"""

        example2 = FinancialOrg("id1", "Founders Fund",
                                ("Founders Fund is a San Francisco based venture capital firm which"
                                 + " invests at every stage in companies with revolutionary"
                                 + " technologies."),
                                "San Francisco", "Space Exploration Technologies", "foundersfund",
                                "http://www.foundersfund.com", "logo_url")

        self.assertEqual(example2.__repr__(), "<FinancialOrg 'Founders Fund'>")
Esempio n. 3
0
    def test_financial_org_dictionary_4(self):
        """Test dictionary method of company class"""

        example2 = FinancialOrg("id1", "Founders Fund",
                                ("Founders Fund is a San Francisco based venture capital firm which"
                                 + " invests at every stage in companies with revolutionary"
                                 + " technologies."),
                                "San Francisco", "Space Exploration Technologies", "foundersfund",
                                "http://www.foundersfund.com", "logo_url")

        dict_rep = example2.dictionary()

        self.assertEqual(dict_rep['companies'],
                         "Space Exploration Technologies")
        self.assertEqual(dict_rep['twitter'], "foundersfund")
        self.assertEqual(dict_rep['website'], "http://www.foundersfund.com")
        self.assertEqual(dict_rep['logo_url'], "logo_url")
Esempio n. 4
0
    def test_financial_org_init_2(self):
        """Test construction of a new company instance"""

        example1 = FinancialOrg("id", "name", "summary", "city", "companies", "twitter",
                                "website", "logo")

        self.assertEqual(example1.companies, "companies")
        self.assertEqual(example1.twitter, "twitter")
        self.assertEqual(example1.website, "website")
        self.assertEqual(example1.logo_url, "logo")
Esempio n. 5
0
    def test_financial_org_init_1(self):
        """Test construction of a new company instance"""

        example1 = FinancialOrg("id", "name", "summary", "city", "companies", "twitter",
                                "website", "logo")

        self.assertEqual(example1.financial_org_id, "id")
        self.assertEqual(example1.name, "name")
        self.assertEqual(example1.summary, "summary")
        self.assertEqual(example1.city, "city")
Esempio n. 6
0
    def test_financial_org_init_4(self):
        """Test construction of a new company instance"""

        example2 = FinancialOrg("id1", "Founders Fund",
                                ("Founders Fund is a San Francisco based venture capital firm which"
                                 + " invests at every stage in companies with revolutionary"
                                 + " technologies."),
                                "San Francisco", "Space Exploration Technologies", "foundersfund",
                                "http://www.foundersfund.com", "logo_url")

        self.assertEqual(example2.companies, "Space Exploration Technologies")
        self.assertEqual(example2.twitter, "foundersfund")
        self.assertEqual(example2.website, "http://www.foundersfund.com")
        self.assertEqual(example2.logo_url, "logo_url")
Esempio n. 7
0
    def test_financial_org_model_2(self):
        """Test querying the database by attribute using simple keywords"""

        with app.test_request_context():
            example1 = FinancialOrg("id", "name", "summary", "city", "companies", "twitter",
                                    "website", "logo")

            db.session.add(example1)
            db.session.commit()

            finorg = db.session.query(FinancialOrg).filter_by(name="name").first()
            self.assertEqual(finorg.city, "city")
            self.assertEqual(finorg.twitter, "twitter")

            db.session.delete(example1)
            db.session.commit()