Skip to content

Commit

Permalink
#275: add tests for the submit command to yukicoder
Browse files Browse the repository at this point in the history
  • Loading branch information
kmyk committed Feb 1, 2019
1 parent 3cd836a commit e4a0fab
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/command_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,46 @@ def test_call_submit_beta_3_b(self):
ojtools = os.path.abspath('oj')
with tests.utils.sandbox(files):
subprocess.check_call([ojtools, 's', '-y', '--no-open', url, 'main.cpp'], stdout=sys.stdout, stderr=sys.stderr)


class SubmitYukicoderTest(unittest.TestCase):
@unittest.skipIf('CI' in os.environ, 'login is required')
def test_call_submit_9000(self):

url = 'https://yukicoder.me/problems/no/9000'
code = '\n'.join([
'#!/usr/bin/env python2',
'print "Hello World!"',
]) + '\n'
files = [
{
'path': 'a.py',
'data': code
},
]
ojtools = os.path.abspath('oj')
with tests.utils.sandbox(files):
subprocess.check_call([ojtools, 's', '-y', '--no-open', url, 'a.py'], stdout=sys.stdout, stderr=sys.stderr)

@unittest.skipIf('CI' in os.environ, 'login is required')
def test_call_submit_beta_3_b(self):

url = 'https://yukicoder.me/problems/no/9001'
code = r'''#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b; cin >> a >> b;
string s; cin >> s;
cout << a + b << ' ' << s << endl;
return 0;
}
'''
files = [
{
'path': 'main.cpp',
'data': code
},
]
ojtools = os.path.abspath('oj')
with tests.utils.sandbox(files):
subprocess.check_call([ojtools, 's', '-y', '--no-open', url, 'main.cpp'], stdout=sys.stdout, stderr=sys.stderr)

0 comments on commit e4a0fab

Please sign in to comment.