This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo kill $(ps -ef | grep [p]ython | awk '{print $2}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.0 | |
os: linux | |
files: | |
- source: / | |
destination: /var/www/html/ | |
overwrite: yes | |
hooks: | |
BeforeInstall: | |
- location: scripts/install_dependencies | |
timeout: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello, World!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.0 | |
os: linux | |
files: | |
- source: / | |
destination: /var/www/html/ | |
hooks: | |
BeforeInstall: | |
- location: scripts/install_dependencies | |
timeout: 300 | |
runas: root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('adding new contacts to the website', () => { | |
const appParent = mount(<App />) | |
beforeEach(() => { | |
appParent.find('.input-name').hostNodes().simulate('change', { target: { value: "Kosinka"}}); | |
appParent.find('.input-phone').hostNodes().simulate('change', { target: { value: "5555"}}); | |
appParent.find('.btn-add').hostNodes().simulate('click'); | |
}); | |
it('has contacts on the website after adding', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('displaying contacts on the website using data from mock fetch', () => { | |
it('has contacts on the website from fetch', () => { | |
expect(app.find('.contacts-list').children().length).toEqual(2); | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jest.mock("../../Api") | |
describe('App', () => { | |
const app = shallow(<App />); | |
it('renders correctly', () => { | |
expect(app).toMatchSnapshot(); | |
}); | |
it('initializes the states with contacts fetched with Api.getContacts()', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
contacts: [] | |
} | |
} | |
componentDidMount() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
class Api { | |
static getContacts() { | |
return new Promise(function(resolve, reject) { | |
resolve([{ | |
name: "Justyna", | |
telephone: "111111", | |
id: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
class Api { | |
static getContacts() { | |
return axios.get('/contacts') | |
.then((response) => { | |
return response.data }) | |
} |