def test_add_acquisition(self): co = Company() #start by creating the required fields #name co.name = "SuperStartup" print('added superstartup in test_add_acquisition') #permalink co.permalink = "superstartup" url = 'http://api.crunchbase.com/v/1/company/m5-networks-3.js' dicta = fetch_json(url) #all_companies_in_database = Company.objects.all() #self.assertEquals(len(all_companies_in_database), 1) #co = all_companies_in_database[0] self.assertEquals(co.name, "SuperStartup") print(co) #Add the acquisition from the json to the add_acq(co, dicta) #a = acquisition() #a.term_code ='shares' #co.acquisition = a print('Acquisition term code: ' + co.acquisition.term_code) #co = all_companies_in_database[0] name = co.name acq_code = co.acquisition.term_code self.assertEquals('cash_and_stock', acq_code) self.assertEquals('shoretel', co.acquisition.acquiring_company.permalink)
def test_company_objects_are_named_as_their_name(self): p = Company() p.name = "Qestu" self.assertEquals(unicode(p), 'Qestu')
def setUp(self): newco = Company() #start by creating the required fields #name newco.name = "SuperStartup" #permalink newco.permalink = "superstartup" #category_code newco.category_code ="software" #number of employees newco.number_of_employees = 3 #founded year newco.founded_year = 2001 #founded_month newco.founded_month = None #deadpooled_year newco.deadpooled_year = None #deadpooled_month newco.deadpooled_month = None #deadpooled_url #newco.deadpooled_url = '' #description newco.description = "newco makes widgets that automate productivity of efficient social features in the health, retail, industry, banking, telecommunications, construction and small business accounting industries" #overview newco.overview = "We are revolution to market" #total_money_raised newco.total_money_raised = "\u20ac183M" #save to database before adding manytomanyfields newco.save() #adding ManyToManyField values #ipo ipo1 = ipo() ipo1.save() newco.ipo.add(ipo1) #tag_list tag1 = tag(tag = "venture-capital-company") tag1.save() tag2 = tag(tag = "disruptive-technology-start-ups") tag2.save() newco.tag_list.add(tag1) newco.tag_list.add(tag2) #funding rounds #financial organization financial1 = financial_org() financial1.name = "Open Ocean" financial1.permalink = "openocean" financial1.save() #investment investment1 = investments() investment1.save() investment1.financial_org.add(financial1) #round round1 = funding_rounds() round1.round_code = "a" round1.raised_amount = 21640000 round1.raised_currency_code = "EUR" round1.funded_year = 2008 round1.funded_month = 10 round1.funded_day = 30 round1.save() print("Saved the easy funding round...") round1.investments.add(investment1) #Add the funding round newco.funding_rounds.add(round1)